package com.pkk.cloud.support.oauth2.common.constant;

/**
 * @description: 认证常量
 * @author: peikunkun
 * @create: 2020-03-18 13:08
 **/
public class OauthConstant {


  /**
   * admin的账号名称
   */
  public static final String SUPER_ADMIN = "admin";

  /** 获取认证类型 **/
  public static final String GRANT_TYPE = "grant_type";


  //角色key
  private final static String USER_ROLE_KEY = "role";
  //服务key
  private final static String SYS_SERVER_KEY = "sys:server:";
  //资源key
  private final static String USER_RESOURCE_KEY = "resource";

  public static String getUserRoleKey(String userId) {
    return userId + ":" + USER_ROLE_KEY;
  }

  public static String getSysServerKey(String serverId) {
    return SYS_SERVER_KEY + serverId;
  }

  public static String getUserServerKey(String userId, String serverId) {
    return getSysServerKey(serverId) + ":" + userId;
  }

  public static String getUserResourceKey(String userId) {
    return userId + ":" + USER_RESOURCE_KEY;
  }


}
